home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
qbbs
/
ld_123.zip
/
LHDOOR.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-05-16
|
19KB
|
529 lines
{PROGRAM : LHDOOR 1.22
AUTHORS : Jan Maaskant(RBBS) - Expansions - 692-0377
(1:387/301)
Jon Hamlin(QuickBBS)- The Programmers Paradise - 654-9134
(1:387/609)
PURPOSE : This isn't really a full scale door, and was never
meant to be, it is meant more as a 'quick fix'
for use with a new file compression scheme until
one of the more inspired and talented folks out
out there decides to make a -real- LHarc door.
OTHER STUFF : Jon and I continually slash at each other's code,
fact is you'll find a lot in here that was done by
either of us. However we don't agree on a lot of
things, and the version of this running on either
of our BBS's will usually look and feel -different-
Doesn't bother us, if it bother's you your welcome
to slash the code into whatever shape you like,
just leave our names in (or suffer horrible
agony in the hereafter...) and shoot us a copy
if you did any good.
}
{$M $4000,0,0} {Needed since we use the Exec function }
Uses DOS;
var
choice : string[1];
fname : string[8];
NewFile : String[8];
file_found : boolean;
paths : text;
path : string[255];
fullfilename : text;
killarcs : text;
di : Text;
ch : string[1];
Dummy : String[50];
i : Integer;
U_Security : Integer;
U_ANSI : Integer;
Set_Sec : Integer;
ValidChoice : Boolean;
IndFName : String[80];
Current : String[255];
CmdStr : String[255];
DelStr : String[255];
Quick_bbs : boolean;
Rbbs_bbs : boolean;
procedure get_params;
VAR count : integer;
begin
rbbs_bbs := false;
quick_bbs := false;
if paramstr(1)='' then
begin
writeln('No parameters Specified. Format is:');
writeln;
writeln('LHDOOR /q for QuickBBS');
writeln(' or');
writeln('LHDOOR /r for RBBS-PC');
writeln;
writeln('LHDOOR will continue in NON-GRAPHICS MODE');
writeln;
end;
if paramcount > 0 then
for count := 1 to paramcount do
begin
if ((paramstr(count) = '/q' ) or
(paramstr(count) = '/Q')) then QUICK_BBS := TRUE;
if ((paramstr(count) = '/r' ) or
(paramstr(count) = '/R')) then RBBS_BBS := TRUE;
end;
end;
procedure colormenu;
begin
writeln('
╔══════════════════════════╡LHDOOR╞══════════════
s');
writeln('u
════════════╗H║
LHZ/ZIP/PAK/ARC Conversion
s');
writeln('u
and Viewing Door
║H║
s');
writeln('u
Version 1.23
║H║
s');
writeln('u
║H║
s');
writeln('u
Support:
RBBS-PC : (512)692-0377 - 1:387
s');
writeln('u
/301
║H║
QuickBBS: (512
s');
writeln('u
)654-9134 - 1:387/609
║H║
s');
writeln('u
║H╟─────────────
s');
writeln('u
─────────────────┬─────────────────────────────╢H║
s');
writeln('u
View
│
Conversion
s');
writeln('u
║H║
~~~~
s');
writeln('u
│
~~~~~~~~~~
║H║
[
s');
writeln('u
D
]
Display file inside LHARC
│
s');
writeln('u
[
E
]
Self-extracting
║H║
s');
writeln('u
[
F
]
File Listing
│
s');
writeln('u
[
P
]
PAK file
║H║
s');
writeln('u
[
L
]
List
│
s');
writeln('u
[
S
]
SEA''s style ARC
║
');
writeln('
H║
[
O
]
Old style view
s');
writeln('u
│
[
Z
]
Zip Format
║
');
writeln('
H║
[
V
]
View
s');
writeln('u
│ ║H║
s');
writeln('u
[
Q
]
Quit back to BBS
s');
writeln('u
║H╚═════════════════════════════════════════════
A');
writeln('C
═══════════════╝
');
write (' Choice: ');
end;
Procedure Graphmenu;
begin
writeln('┌────────────────────────────────────────────────────────┐');
writeln('│ ░▒▓ LHDOOR ▓▒░ │');
writeln('│ │');
writeln('│ Support: RBBS-PC : (1:387/301) (512)692-0377 │');
writeln('│ QuickBBS : (1:387/609) (512)654-9134 │');
writeln('│ │');
writeln('│ LZH/ZIP/PAK/ARC Conversion and Viewing Door │');
writeln('│ Version 1.23 │');
writeln('│ │');
writeln('│ VIEW LZH file CONVERT │');
writeln('│ ───────────── ─────── │');
writeln('│ (L)ist (E) Self Extracting │');
writeln('│ (V)iew (P) PAK file │');
writeln('│ (O)ld style view (S) SEA style ARC │');
writeln('│ (D)isplay file inside a LHARC (Z) Zip format │');
writeln('│ (F)ile List │');
writeln('│ │');
writeln('│ (Q)uit back to BBS │');
writeln('└────────────────────────────────────────────────────────┘');
write (' Choice: ');
end;
procedure monomenu;
begin
writeln;
writeln(' -= LHDOOR =-');
writeln(' LZH/ZIP/PAK/ARC Conversion and Viewing Door');
writeln(' Version 1.23');
writeln;
writeln(' Support: RBBS-PC : (1:387/301) (512)692-0377');
writeln(' QuickBBS : (1:387/609) (512)654-9134');
writeln;
writeln;
writeln(' VIEW LZH file CONVERT');
writeln(' ---- -------');
writeln('(L)ist (E) Self Extracting');
writeln('(V)iew (P) PAK file');
writeln('(O)ld style view (S) SEA'' style ARC');
writeln('(D)isplay file inside a LHARC (Z) Zip format');
writeln('(F)ile Listing');
writeln;
writeln(' (Q)uit back to BBS');
writeln;
write(' Choice: ');
end;
Procedure QuickDisp;
Var ii : integer;
desc : string[128];
iz : integer;
Good_Area : boolean;
fbbs : string[255];
psed : char;
begin
for ii := 1 to 5 do
writeln;
Assign(di,'FLSEARCH.CTL');
Good_Area := false;
While Not Good_Area do
begin
reset(di);
ii := 1;
While not eof(di) do
begin
ch:='z';
while ch <> ' ' do
read(di,ch);
while ch = ' ' do
read(di,ch);
Read(di,Set_Sec);
while ch = ' ' do
read(di,ch);
readln(di,desc);
If Set_Sec <= U_Security
then writeln('[',ii:3,']',' ',desc);
ii:=ii+1;
end;
ii:=ii-1;
Write('Which file area to list: ');
Readln(iz);
If (iz >= 1) and (iz <= ii)
then Good_Area := true;
end;
reset(di);
For ii := 1 to (iz-1) do
readln(di,ch);
fbbs:='';
While ch <> ' ' do
begin
read(di,ch);
if ch <> ' '
then fbbs:=fbbs+ch;
end;
close(di);
fbbs:=fbbs+'\FILES.BBS';
assign(di,fbbs);
{$I-}
reset(di);
{$I+}
if IORESULT <> 0
then begin
writeln('MISSING '+fbbs+'!! Please notify the sysop.');
halt(1);
end;
close(di);
Write('Do you want continuous (non-paused) output? ');
readln(psed);
if (psed='n') or (psed='N')
then Exec('C:\COMMAND.COM',' /C TYPE '+fbbs+' | MORE')
else Exec('C:\COMMAND.COM',' /C TYPE '+fbbs);
Writeln;
Write('Hit [Enter] to continue');
Readln;
end;
procedure up_choice;
var
ch : char;
begin
ch := choice[1];
ch := upcase(ch);
choice := ch;
end;
procedure get_file_name;
var
dimwit : boolean;
begin
dimwit := true;
while dimwit do
begin
write(' Enter the filename (No Extension) > ');
readln(Fname);
writeln;
dimwit :=false; {intelligent until proven dimwitted}
if fname='' then
begin
writeln('Not a valid filename');
dimwit := true;
end
else begin
i := 1;
NewFile := '';
While (fname[i] <> '.') and (i <= Length(fname)) do
begin
NewFile := NewFile + fname[i];
i := i + 1;
end;
fname := NewFile;
end;
end; {If they added an extension}
end;
procedure find_file;
begin
write(' Now searching for the file');
{$I-}
reset(paths);
{$I+}
if not(ioresult=0) then
begin
writeln;
writeln('Please Inform Sysop, FLSEARCH.CTL missing');
writeln(' ## Program Aborted - Exit Code 1 ##');
halt(1);
end;
file_found := false;
while (not(eof(paths)) and not(file_found)) do
begin
path := '';
ch := 'Y';
while ((ch <> ' ') and not(eof(paths))) do
begin
read(paths,ch);
if ch <> ' '
then path := path + ch;
end;
ch := '';
Readln(paths,Set_Sec);
if copy(path,length(path),1)='\' then path := copy(path,1,length(path)-1);
path := path + '\';
assign(fullfilename,path+fname+'.LZH');
{$I-}
reset(fullfilename);
{$I+}
if (IORESULT=0) and (Set_Sec <= U_Security)
then
file_found := TRUE
else
write('.');
end;
writeln;
end;
PROCEDURE CHOICE_E;
begin
writeln;
writeln(' File located...');
writeln(' Creating self-extracting file now, please hold...');
MkDir('\_$LHTMP');
ChDir('\_$LHTMP');
Exec('C:\COMMAND.COM',' /C LHARC s '+PATH+FNAME+' > NUL:');
Exec('C:\COMMAND.COM',' /C COPY '+FNAME+'.COM '+PATH+FNAME+'.COM >NUL');
Exec('C:\COMMAND.COM',' /C DEL '+FNAME+'.COM');
ChDir(Current);
RmDir('\_$LHTMP');
writeln(' The file is ',fname,'.COM, but is not listed.');
writeln(' It will be DELETED in the nightly event');
writeln(' so -Get it NOW-');
Writeln;
Writeln(' Hit Enter to continue');
ReadLn;
assign(killarcs,'KILLARCS.BAT');
{$I-}
append(killarcs);
{$I+}
if not(ioresult=0) then rewrite(killarcs);
writeln(killarcs,'DEL ',path+fname,'.COM');
close(killarcs);
end;
procedure choice_VLOD;
var
fspec : string[255];
pausit : string[1];
begin
if choice='O' then Exec('C:\COMMAND.COM','/C LVIEW '+path+fname);
if choice='V' then Exec('C:\COMMAND.COM','/C LHARC V '+path+fname);
if choice='L' then Exec('C:\COMMAND.COM','/C LHARC L '+path+fname);
if choice='D' then
begin
Exec('C:\COMMAND.COM','/C LHARC L '+path+fname);
writeln('Enter the filespec you wish to VIEW or [ENTER] for all files');
write('within '+fname+': ');
readln(fspec);
write('Paused? ([Y]/n)');
readln(pausit);
writeln(' Please turn on CAPTURE now!');
writeln(' -------Begin Display-------');
if ((pausit='n') or (pausit='N'))
then
Exec('C:\COMMAND.COM',' /C LHARC P '+path+fname+' '+fspec+' | MORE')
else
Exec('C:\COMMAND.COM',' /C LHARC P '+path+fname+' '+fspec);
writeln(' --------End Display--------');
end;
Write(' Press [ENTER] to contine: ');
Readln;
end;
procedure choice_spz;
begin
writeln;
write('File located - Now creating the archive in ');
if choice='S' then write ('ARC ');
if choice='P' then write ('PAK ');
if choice='Z' then write ('ZIP ');
writeln('compatible format');
writeln(' Patience..');
assign(killarcs,'KILLARCS.BAT');
{$I-}
append(killarcs);
{$I+}
if not(ioresult=0) then rewrite(killarcs);
write(killarcs, 'DEL ',path+fname);
if choice='S' then writeln(killarcs,'.ARC');
if choice='P' then writeln(killarcs,'.PAK');
if choice='Z' then writeln(killarcs,'.ZIP');
close(killarcs);
{$I-}
Mkdir('\_$LHTMP');
{$I+}
if not(ioresult=0) then
writeln('Warning - Temporary Directory already Exists!');
{$I-}
Chdir('\_$LHTMP');
{$I+}
if not(ioresult=0) then
begin
writeln('Fatal Error - Unable to access Temporary Directory');
writeln(' Exit Code 1');
halt(1);
end;
write('Clearing Work Directory..');
EXEC('C:\COMMAND.COM',' /C ECHO Y >Y'); {Avoids 'File Not Found'}
EXEC('C:\COMMAND.COM',' /C ECHO Y|DEL *.* >NUL');
Exec('C:\COMMAND.COM',' /C LHARC e /m '+PATH+FNAME);
If choice <> 'Z'
then CmdStr := 'PAK A /WA '
else CmdStr := 'PKZIP -A -EX ';
if choice = 'S' then CmdStr := CmdStr+'/C ';
CmdStr := CmdStr+path+Fname;
if choice='S' then cmdstr := cmdstr+'.ARC';
if choice='P' then cmdstr := cmdstr+'.PAK';
if choice='Z' then cmdstr := cmdstr+'.ZIP';
Exec('C:\COMMAND.COM',' /C '+CmdStr);
EXEC('C:\command.com',' /C ECHO Y|DEL *.* >NUL');
ChDir(Current);
{SI-}
RmDir('\_$LHTMP');
{$I+}
if not(ioresult=0) then
begin
writeln('Warning - Unable to remove temporary directory');
writeln(' Inform Sysop');
end;
writeln;
if Choice = 'Z' then
writeln(' Conversion complete, file is ',fname,'.ZIP.');
if Choice = 'S' then
writeln(' Conversion complete, file is ',fname,'.ARC.');
if Choice = 'P' then
writeln(' Conversion complete, file is ',fname,'.PAK.');
writeln(' It is available for download, but is not in');
writeln(' the file listings.');
writeln;
writeln(' NOTE: this file will be DELETED in the nightly event');
writeln(' You may return to the BBS and download at your');
writeln(' Convenience.');
writeln;
Writeln(' Press [ENTER] to continue');
ReadLn;
end;
procedure not_found_msg;
begin
writeln;
writeln(' Sorry, the file ',fname,'.LZH was not found on the disk');
writeln(' If this is the correct name then please inform the sysop of the');
writeln(' problem. If this was not the correct name then please feel');
writeln(' free to try again.');
writeln;
write('Press [ENTER] ');
readln;
writeln;
writeln;
end; {Bad file was entered}
procedure get_user_info;
begin
Assign(di,'DORINFO1.DEF');
Reset(di);
for i := 1 to 9 do Readln(di, Dummy);
Readln(di,U_ANSI);
Readln(di,U_Security);
Close(di);
if QUICK_BBS then If U_ANSI=1 then U_ANSI := 2;
if PARAMCOUNT=0 then U_ANSI:=0;
end;
{-------------------Main Loop-------------------}
begin
get_params;
while TRUE do
BEGIN
GetDir(0,Current);
get_user_info;
ValidChoice := False;
while not ValidChoice do
begin
ASSIGN (PATHS,'flsearch.ctl');
choice := 'Y';
while not ((choice='P') or
(choice='D') or
(choice='S') or
(choice='Q') or
(choice='V') or
(choice='L') or
(choice='E') or
(choice='O') or
(choice='F') or
(choice='Z')) do
begin
if U_ANSI = 0 then monomenu;
if U_ANSI = 1 then graphmenu;
if U_ANSI = 2 then colormenu;
readln(choice);
up_choice;
end;
IF CHOICE = 'Q' then HALT(0) else
begin
if choice='F'
then if Quick_BBS then QuickDisp;
{ else if RBBS_BBS then RBBSDisp} {temporarily commented}
if choice<>'F'
then begin
get_file_name;
find_file;
if not(file_found) then not_found_msg;
if (file_found) then
if choice='E' then choice_E;
if (((choice='V') or
(choice='L') or
(choice='O') or
(choice='D')) and
file_found) then CHOICE_VLOD;
if (((choice='S') or
(choice='P') or
(choice='Z')) and
file_found) then CHOICE_SPZ;
{$I-}
close(paths);
{$I+}
end;
end;
end;
end; {While not validchoice do}
end.